<template>
	<view>
		<view class="app-search-wrap shadow">
			<view class="bd">
				<uni-search-bar class="search" cancelButton='none' @confirm="search" :focus="true" v-model="searchValue"
					@blur="blur" @focus="focus" @input="input" @cancel="cancel" @clear="clear">
				</uni-search-bar>
			</view>
		</view>
		<view class="list-item" v-for="(item, index) in listData" :key="index" @click="showDetail" 
			:index="index"  hover-class="hover" hover-start-time="10">
			<uni-list>
				<uni-list-item :title="item"  link @click="onClick($event,item)">
					</uni-list-item>
			</uni-list>
				<view class="name">
					<view class="bd">
						<!-- <view> {{item.nextDayPlan}} </view> -->
					</view>
					<!-- <view class="ft">{{item.userName}}</view> -->
				</view>

				<!-- <view class="info"> {{item.nextDayPlan}} </view> -->
				<view class="date">
					<!-- <view class="bd">创建时间: {{item.createTime}}</view> -->
					<!-- <view wx:if="{{item.status != 'C'}}" class="btn btn-del" data-id="{{item.id}}" data-index="{{index}}" catchtap="showDisable">
		                    <view>删除</view>
		                </view> -->
				</view>
			</view>
			
			<uv-empty v-if="!listData.length" mode="list"></uv-empty>
		</view>
	</view>
</template>

<script>
	import {
		log
	} from 'util';
	import {
		baseUrl
	} from '@/config.js';
	import {
		getPositionList
	} from '@/api/me'
	export default {
		data() {
			return {
				searchValue: '',
				current: 1,
				total: 0,
				pageSize: 20,
				listData: []
			}
		},
		onLoad() {
			this.getListDate();
		},
		methods: {
			getListDate(e) {
				if (e) {
					let {
						type,
						current
					} = e;
					console.log(type, current)
					this.current = current;
				}

				// let res = await getList()
				uni.showLoading({title: '加载中...', mask:true})
				getPositionList({
					pageSize: this.pageSize,
					pageNum: this.current,
					searchValue: this.searchValue,
				}).then(res => {
					setTimeout(() => { 					uni.hideLoading()})
					console.log(res)
					this.listData = res;
				})
			},
			search(res) {
				uni.showToast({
					title: '搜索：' + res.value,
					icon: 'none'
				})
			},
			input(res) {
				this.searchValue = res;
				this.getListDate()
			},
			onClick(e, id) {
				console.log(e, id);
				uni.navigateTo({
					url: `/pages/work/pt-detail/index?id=${id}`,
				})
			
			},
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #fff;
		padding-top: 110rpx;

		/* padding-top: 100rpx; */
	}

	.header {
		display: flex;
		align-items: center;
		justify-content: space-around;

	}
</style>